﻿<UserControl x:Class="Kiva7.Pages.CombinedPaymentsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:my="clr-namespace:AmCharts.Windows.QuickCharts;assembly=AmCharts.Windows.QuickCharts.WP" 
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid>

        <ProgressBar Visibility="{Binding IsLoaded, Converter={StaticResource booleanToNotVisibility}}" 
                     IsIndeterminate="{Binding IsLoaded, Converter={StaticResource notBooleanConverter}}" 
                     Style="{StaticResource CustomIndeterminateProgressBar}"
                     VerticalAlignment="Center" />

        <ScrollViewer Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">
            <StackPanel DataContext="{Binding SingleData}">
                <my:SerialChart x:Name="chart1" 
                            DataSource="{Binding CombinedPayments}" 
                            CategoryValueMemberPath="DateString"
                            AxisForeground="White" 
                            LegendVisibility="Collapsed"
                            PlotAreaBackground="Black"
                            GridStroke="DarkGray"
                            Height="400">
                    <my:SerialChart.Graphs>
                        <my:ColumnGraph ValueMemberPath="Scheduled" Brush="Green" ColumnWidthAllocation="0.8" />
                        <my:ColumnGraph ValueMemberPath="Actual" Brush="Blue" ColumnWidthAllocation="0.4" />
                    </my:SerialChart.Graphs>
                </my:SerialChart>

                <ListBox x:Name="lbxPayments" Margin="0,0,-12,0" 
                    Background="{StaticResource KivaBackgroundBrush}"
                    ItemsSource="{Binding CombinedPayments}" 
                    HorizontalContentAlignment="Stretch" >
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel></StackPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" >
                                <TextBlock Text="{Binding Scheduled, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}" 
                                Width="120"  TextAlignment="Right"/>

                                <TextBlock Text="{Binding Actual, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}" 
                                Width="120"  TextAlignment="Right"/>

                                <TextBlock Text="{Binding Date, Converter={StaticResource toShortDate}}" 
                            Style="{StaticResource KivaTextAccentStyle}"/>

                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
